const query = require('../db/query')

// 获取评论条件
const getClassify = (params)=>{
    let sql = `select * from classify`
    return query(sql)
}

// 获取评论列表
const getReviewList = (params)=>{
    let sql = `select * from review where reviewdoctorid = '${params.id}' and reviewstate like '%${params.state}%' `
    return query(sql)
}

// 新增评论列表
const addReview = (params) =>{
    let sql = `INSERT INTO review (reviewname,reviewtitle,reviewdoctorid,reviewstate,reviewgood) VALUES ('${params.name}','${params.title}','${params.doctorid}','${params.state}','${params.good}')`
    return query(sql)
}

// 获取锦旗
const getBanner = (params)=>{
    let sql = `select * from banner`
    return query(sql)
}

// 赠送锦旗
const giveBanner = (params)=>{
    let sql = `INSERT INTO banview (banviewname,banviewimage,banviewstate,banviewtimer,banviewdoctorid) VALUES ('${params.name}','${params.image}','${params.state}','${params.timer}','${params.doctorid}')`
    return query(sql)
}

// 获取锦旗评论
const getBanview = (params)=>{
    let sql = `select * from banview where banviewdoctorid = '${params.id}' and banviewstate like '%${params.state}%' `
    return query(sql)
}

// 获取视频
const getVidou = (params)=>{
    let sql = `select * from vodiu where vodiustate like '%${params.state}%'`
    return query(sql)
}

module.exports = {
    getReviewList,
    addReview,
    getClassify,
    getBanner,
    giveBanner,
    getBanview,
    getVidou
}